﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RegPhone.aspx.cs" Inherits="ZLCMS.Web.MemberUser.RegPhone" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>手机号注册</title>
    <link href="/MemberUser/css/cui.css" rel="stylesheet" type="text/css" />
    <link href="/MemberUser/css/all.css" rel="stylesheet" type="text/css" />
    <link href="/MemberUser/css/member.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="/js/validform/Validform_v5.3.2_min.js"></script>
    <link rel="stylesheet" href="/css/validform/style.css" />
    <script src="/js/Common.js" type="text/javascript"></script>
    <script src="/js/jquery.json-2.2.min.js" type="text/javascript"></script>
</head>
<body style="background: #fff;">
    <div id="top">
        <div class="top_box">
            <ul class="left">
                <li class="hello">您好，欢迎来到我和你官网！</li>
                <li>
                    <%= Session[ZLCMS.Business.Util.GlobalSessionString.CurrentMemberAccount] == null ? "<a href='/MemberUser/Login.aspx' class='login'> [登录]</a> | <a href='/MemberUser/RegEmail.aspx' class='regist'>[注册]</a>" : "<a href='javascript:void(0);' onclick='Logout()'  class='regist'>[退出]</a>"%></li>
                <div class="clear">
                </div>
            </ul>
            <ul class="right">
                <li class="topsub"><a href="/MemberUser/Default.aspx" class="tik">用户中心<i><img src="images/top_icon.png"
                    width="9" height="8" /></i></a>
                    <ul class="topsubpage">
                        <li><a href="/MemberUser/ChgPasswd.aspx">修改密码</a></li>
                        <li><a href="/MemberUser/ModifyUserInfo.aspx">修改基本资料</a></li>
                        <li><a href="/MemberUser/MyAddress.aspx">我的收货地址</a></li>
                        <li><a href="javascript:void(0);" onclick="Logout()">退出</a></li>
                    </ul>
                </li>
                <li class="topsub1"><a href="/MemberUser/MyOrder.aspx" class="tik1">我的订单<i><img src="images/top_icon.png"
                    width="9" height="8" /></i></a>
                    <ul class="topsubpage1">
                        <li><a href="/MemberUser/MyOrder.aspx?type=unpaid">待支付订单</a></li>
                        <li><a href="/MemberUser/MyOrder.aspx">全部订单</a></li>
                    </ul>
                </li>
                <li><a href="/shopcart/shoppingcart.aspx">
                    <img src="images/top_cart.png" width="17" height="16" />购物车</a></li>
                <div class="clear">
                </div>
            </ul>
            <div class="clear">
            </div>
        </div>
    </div>
    <!--wrapper start-->
    <div id="main">
        <div class="regist_top">
            <!--logo start-->
            <div class="regist_logo">
                <a href="#">
                    <img src="/MemberUser/images/logo.png" style="width: 57.9mm; height: 25mm" /></a></div>
            <!--logo end-->
            <div class="regist_yous">
                <img src="/MemberUser/images/regist_yous.jpg" width="370" height="41" /></div>
            <div class="clear">
            </div>
        </div>
        <div class="regist_banner">
            <a href="#">
                <img src="/MemberUser/images/regist_banner.jpg" width="980" height="62" /></a></div>
        <div class="regist_box">
            <div class="r_left">
                <ul id="tabs">
                    <li onclick="window.location.href='RegEmail.aspx'">邮箱注册</li>
                    <li class="active">手机号注册</li>
                    <div class="clear">
                    </div>
                </ul>
                <div class="tabs_box">
                    <div class="con1">
                        <form id="Form1" runat="Server" class="registerform">
                        <div class="inp">
                            <label>
                                手机号</label><asp:TextBox ID="tb_id" runat="server" datatype="m" errormsg="请填写正确的手机号！"
                                    nullmsg="请填写手机号！"></asp:TextBox><div class="clear">
                                    </div>
                        </div>
                        <div class="checktip">
                            <span class="Validform_checktip"></span>
                        </div>
                        <div class="inp">
                            <label>
                                验证码</label><asp:TextBox ID="tb_cc" Width="100px" runat="server" datatype="" errormsg="请填写正确的验证码！"
                                    nullmsg="请填写验证码！"></asp:TextBox>
                            <a href="javascript:void(0);" onclick="GetCheckCode(this)" id="a_get_code">获取手机验证码</a>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="checktip">
                            <span class="Validform_checktip"></span>
                        </div>
                        <div class="inp">
                            <label>
                                密码</label><asp:TextBox ID="tb_pwd1" name="tb_pwd1" runat="server" MaxLength="16"
                                    TextMode="Password" datatype="*6-16" errormsg="请填写6-16位密码！" nullmsg="请请填写6-16位密码！"></asp:TextBox><div
                                        class="clear">
                                    </div>
                        </div>
                        <div class="checktip">
                            <span class="Validform_checktip"></span>
                        </div>
                        <div class="inp">
                            <label>
                                重复密码</label><asp:TextBox ID="tb_pwd2" runat="server" MaxLength="16" TextMode="Password"
                                    recheck="tb_pwd1" errormsg="您两次输入的账号密码不一致！" nullmsg="请再输入一次密码！" datatype="*6-16"></asp:TextBox><div
                                        class="clear">
                                    </div>
                        </div>
                        <div class="checktip">
                            <span class="Validform_checktip"></span>
                        </div>
                        <%-- <div class="inp"><label>验证码</label><asp:TextBox ID="tb_cc" runat="server" Width="100px" datatype="*" errormsg="请填写验证码！" nullmsg="请填写验证码！"></asp:TextBox><img id="imgCode" alt="看不清，请点击我！" src="/Tools/CheckCode.aspx" style=" cursor: pointer; width: 70px; height: 40px ;" onclick="cimg()"  /><a href="javascript:void()" onclick="cimg()">换一张</a></div>
    <div class="checktip"><span class="Validform_checktip"></span></div>--%>
                        <div class="tongyi">
                            <input name="tongyi" type="checkbox" value="*" datatype="*" nullmsg="请同意《<%=siteName %>用户协议》！"
                                errormsg="请同意《<%=siteName %>用户协议》！" /><a href="/helpview.aspx?uid=280&kind=UserAgreement">同意《<%=siteName %>用户协议》</a></div>
                        <div class="checktip">
                            <span class="Validform_checktip"></span>
                        </div>
                        <p class="tijiao">
                            <asp:Button ID="Button1" class="submit" runat="server" Text="注册" OnClick="Button1_Click" />
                            <input class="submit" value="返回" onclick="javascript:location.href='/Default.aspx'" />
                        </p>
                        </form>
                    </div>
                </div>
            </div>
            <div class="r_right">
                <p>
                    已有<%=siteName %>账号？</p>
                <p>
                    <a href="/MemberUser/Login.aspx">立即登录</a></p>
                <div class="other">
                    <%--	<p>你也可以使用以下账号登录</p>
          <ul>
           	  <li><a href="#">   <span id="qqLoginBtn"></span>
              <script type="text/javascript">
                  QC.Login({
                      btnId: "qqLoginBtn"
                  }, cbLoginFun);
            </script></a>
              </li>
              <li><a href="#" >  <wb:login-button type="3,2" onlogin="login" onlogout="logout" id="btn_wb_login" ></wb:login-button></a>
              </li>
              <div class="clear"></div>
          </ul>--%>
                </div>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
    <!--wrapper end-->
    <!--底部开始-->
    <div id="footer">
    </div>
    <!--底部结束-->
    <!--微博登录start-->
    <%-- <script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=765311252" type="text/javascript" charset="utf-8"></script>--%>
    <script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=765311252&debug=true"
        type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        function login(o) {

            //判断用户是否已注册
            $("#btn_wb_login").ExecuteCommand({
                successCallBack: function (result) {

                    if (result.IsRegistered == "1") {
                        location.href = "/MemberUser/Default.aspx";
                    }
                    else if (result.IsRegistered == "-1") {
                        //提示是否绑定原有账户
                        if (confirm('是否绑定原有账户？')) {
                            //跳转绑定账户页面
                            location.href = "/MemberUser/bindaccount.aspx?type=weibo&openid=" + o.idstr;
                        }
                        else {
                            //添加新账户
                            location.href = "/MemberUser/GenerateAccount.aspx?type=weibo&openid=" + o.idstr;
                        }
                    }
                },
                errorCallback: function (errorCode, msg) {
                    alert(msg);
                }
            }, 'JudgeIsRegistered', { Type: "weibo", OpenId: o.idstr });
        }
        function logout() {
            alert('logout');
        }
    </script>
    <!--微博登录end-->
    <!--QQ登录start-->
    <script type="text/javascript" src="http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js"
        data-appid="101158036" charset="utf-8"></script>
    <script type="text/javascript">

        var cbLoginFun = function (oInfo, oOpts) {

            if (QC.Login.check()) {//如果已登录
                QC.Login.getMe(function (openId, accessToken) {

                    //这里做操作
                    //判断用户是否已注册
                    $("#btn_wb_login").ExecuteCommand({
                        successCallBack: function (result) {
                            //                            QC.Login.signOut()
                            if (result.IsRegistered == "1") {
                                location.href = "/MemberUser/Default.aspx";
                            }
                            else if (result.IsRegistered == "-1") {
                                //提示是否绑定原有账户
                                if (confirm('是否绑定原有账户？')) {
                                    //跳转绑定账户页面
                                    location.href = "/MemberUser/bindaccount.aspx?type=qq&openid=" + openId;
                                }
                                else {
                                    //添加新账户
                                    location.href = "/MemberUser/GenerateAccount.aspx?type=qq&openid=" + openId;
                                }
                            }
                        },
                        errorCallback: function (errorCode, msg) {
                            alert(msg);
                        }
                    }, 'JudgeIsRegistered', { Type: "qq", OpenId: openId, AccessToken: accessToken });
                    //     alert(["当前登录用户的", "openId为：" + openId, "accessToken为：" + accessToken].join("\n"));
                });
            }
        };

        //QQ登录end

        function cimg() {
            var changetime = new Date().getTime();
            document.getElementById('imgCode').src = '/Tools/CheckCode.aspx?' + changetime;
        }
        $(function () {
            $(".registerform").openValidform();
        });
        var IsCheckCodeBtnAble = true;
        function GetCheckCode(el) {
            if (!IsCheckCodeBtnAble) {
                return false;
        }
            var myreg = /^(((13[0-9]{1})|159|153)+\d{8})$/;
            if (!myreg.test($("#<%= tb_id.ClientID %>").val())) {
                alert('请输入有效的手机号码！');
                return false;
            }
            //判断手机号码是否验证通过
            if ($("#<%= tb_id.ClientID %>").hasClass( "Validform_error")) {
                alert("请输入有效的手机号码！");
                return false;
            }
            IsCheckCodeBtnAble = false;
            $(el).css("backgroundColor", "grey");
            $(el).ExecuteCommand({
                successCallBack: function (result) {
                 
                    //按钮30秒倒数 不可用，
                   
                    var isAble = true;
                    var times = 60;
                    var s = setInterval(function () {
                        if (times == 0) {
                            isAble = false;
                            window.clearInterval(s);
                            //按钮置为可用
                            $(el).html("获取手机验证码");
                            $(el).css("backgroundColor", "#f8296d");
                            IsCheckCodeBtnAble = true;
                        }
                        else {
                            times--;
                            $(el).html(times + "秒后重新发送")
                        }
                    }, 1000);
                },
                errorCallback: function (errorCode, msg) {
                    IsCheckCodeBtnAble = true;
                    $(el).css("backgroundColor", "#f8296d");
                    alert(msg);
                }
            }, 'SendCheckCodeMsg', { Phone: $("#<%=tb_id.ClientID %>").val(), MemberAccount: $("#<%=tb_id.ClientID %>").val() });
        }
    </script>
</body>
</html>
